﻿
using MySql.Data.MySqlClient;
using PureMVC.Interfaces;
using Rail.Commons.SerializeHelper;
using System;

namespace Rail.Start.Viewer
{
    public class NetWorkSettingFormMediator : PureMVC.Patterns.Mediator, IMediator
    {
        NetWorkSettingForm m_NetWorkSettingForm;
        public NetWorkSettingFormMediator(NetWorkSettingForm viewComponent)
               : base(NAME, viewComponent)
        {
            m_NetWorkSettingForm = viewComponent;
            m_NetWorkSettingForm.simpleButton1.MouseClick += ConnectDataBase;
        }
        private void ConnectDataBase(object sender, EventArgs e)
        {
            IniHelper.SetVal("DB", "ip", m_NetWorkSettingForm.databaseIp.Text);
            IniHelper.SetVal("DB", "dbName", m_NetWorkSettingForm.databaseName.Text);
            IniHelper.SetVal("DB", "dbUser", m_NetWorkSettingForm.databaseUid.Text);
            IniHelper.SetVal("DB", "pwd", m_NetWorkSettingForm.databasePwd.Text);
        }
    }
}
